#!/bin/bash
 
filein=molecules.txt
template=aldx_templ
 
rm results.dat summary.dat *.expo *.bin *_best*.cif
c=`wc -l $filein | awk '{print $1}'`
 
for i in `seq 1 $c`;
do
a=`cat $filein | head -$i | tail -1`
file=${a%.*}
echo $file $template
sed "s%STRNAME%$file%" $template > "$file.exp"
#expo "$file.exp" "$file.out" --nogui
mpirun -np 25 -oversubscribe $HOME/expo/expo_mpi "$file.exp" "$file.out"
echo "============================================================" >> results.dat
echo "$file.out" >> results.dat
grep @@  "$file.out" | cut -c3-  >> results.dat
grep @@best  "$file.out" | cut -c3-  >> summary.dat
done
